package game;
import java.awt.Dimension;
import java.util.ArrayList;

import javax.swing.ImageIcon;


public class GameBoard {
		private ArrayList<GameField> gameBoard;
		private GameField start;
		private GameField end;
		private GameField jail;
		public static String imageFolder = "images/UK Fields/";
		private static GameBoard INSTANCE=null;
		
		public GameBoard(){	
			INSTANCE=this;
		}
		
		public void createGameBoard(){
			gameBoard = new ArrayList<GameField>();
			start=new GameField(imageFolder+"Go.png",GameField.START, GameField.UP,0);
			gameBoard.add(start);
			gameBoard.add(new GameField(imageFolder+"Liverpool.png",GameField.NORMAL, GameField.UP, 600000));
			gameBoard.add(new GameField(imageFolder+"Community_Chest1.png",GameField.COMMUNITY_CHEST, GameField.UP,0));			
			gameBoard.add(new GameField(imageFolder+"Leeds.png",GameField.NORMAL, GameField.UP, 600000));
			gameBoard.add(new GameField(imageFolder+"Income_Tax1.png",GameField.TAX, GameField.UP,2000000));
			gameBoard.add(new GameField(imageFolder+"Glasgow_Airport.png", GameField.AIRPORT, GameField.UP,2000000));
			gameBoard.add(new GameField(imageFolder+"Middlesbrough.png",GameField.NORMAL, GameField.UP,1000000));
			gameBoard.add(new GameField(imageFolder+"Chance1.png",GameField.CHANCE, GameField.UP,0));
			gameBoard.add(new GameField(imageFolder+"Cardiff.png",GameField.NORMAL, GameField.UP,1000000));
			gameBoard.add(new GameField(imageFolder+"York.png",GameField.NORMAL, GameField.UP,1200000));
			jail= new GameField(imageFolder+"Visit_Jail.png",GameField.JAIL, GameField.UP,0);
			gameBoard.add(jail);
			
			gameBoard.add(new GameField(imageFolder+"Colchester.png",GameField.NORMAL, GameField.RIGHT,1400000));
			gameBoard.add(new GameField(imageFolder+"Telecoms.png",GameField.COMMUNICATION, GameField.RIGHT,1500000));
			gameBoard.add(new GameField(imageFolder+"Manchester.png",GameField.NORMAL, GameField.RIGHT,1400000));
			gameBoard.add(new GameField(imageFolder+"London.png",GameField.NORMAL, GameField.RIGHT,1600000));
			gameBoard.add(new GameField(imageFolder+"Belfast_Airport.png",GameField.AIRPORT, GameField.RIGHT,2000000));
			gameBoard.add(new GameField(imageFolder+"Derby.png",GameField.NORMAL, GameField.RIGHT,1800000));
			gameBoard.add(new GameField(imageFolder+"Community_Chest2.png",GameField.COMMUNITY_CHEST, GameField.RIGHT,0));
			gameBoard.add(new GameField(imageFolder+"Plymouth.png",GameField.NORMAL, GameField.RIGHT,1800000));
			gameBoard.add(new GameField(imageFolder+"Lincoln.png",GameField.NORMAL, GameField.RIGHT,2000000));
			gameBoard.add(new GameField(imageFolder+"Free_Parking.png",GameField.FREE_PARKING, GameField.RIGHT,0));
			
			gameBoard.add(new GameField(imageFolder+"Dundee.png",GameField.NORMAL, GameField.DOWN,2200000));
			gameBoard.add(new GameField(imageFolder+"Chance3.png",GameField.CHANCE, GameField.DOWN,0));
			gameBoard.add(new GameField(imageFolder+"Keele.png",GameField.NORMAL, GameField.DOWN,2200000));
			gameBoard.add(new GameField(imageFolder+"Norwich.png",GameField.NORMAL, GameField.DOWN,2400000));
			gameBoard.add(new GameField(imageFolder+"Cardiff_Airport.png",GameField.AIRPORT, GameField.DOWN,2000000));
			gameBoard.add(new GameField(imageFolder+"Birmingham.png",GameField.NORMAL, GameField.DOWN,2600000));
			gameBoard.add(new GameField(imageFolder+"Oxford.png",GameField.NORMAL, GameField.DOWN,2600000));
			gameBoard.add(new GameField(imageFolder+"Satellite.png",GameField.COMMUNICATION, GameField.DOWN,1500000));
			gameBoard.add(new GameField(imageFolder+"Stoke_on_Trent.png",GameField.NORMAL, GameField.DOWN,2800000));
			
			gameBoard.add(new GameField(imageFolder+"To_Jail.png",GameField.TO_JAIL, GameField.LEFT,0));
			gameBoard.add(new GameField(imageFolder+"Sheffield.png",GameField.NORMAL, GameField.LEFT,3000000));
			gameBoard.add(new GameField(imageFolder+"Cambridge.png",GameField.NORMAL, GameField.LEFT,3000000));
			gameBoard.add(new GameField(imageFolder+"Community_Chest4.png",GameField.COMMUNITY_CHEST, GameField.LEFT,0));
			gameBoard.add(new GameField(imageFolder+"Nottingham.png",GameField.NORMAL, GameField.LEFT,3200000));
			gameBoard.add(new GameField(imageFolder+"Luton_Airport.png",GameField.AIRPORT, GameField.LEFT,200000));
			gameBoard.add(new GameField(imageFolder+"Chance4.png",GameField.CHANCE, GameField.LEFT,0));
			gameBoard.add(new GameField(imageFolder+"Exeter.png",GameField.NORMAL, GameField.LEFT,3500000));
			gameBoard.add(new GameField(imageFolder+"Super_Tax1.png",GameField.TAX, GameField.LEFT,1000000));
			end= (new GameField(imageFolder+"St_Albans.png",GameField.NORMAL, GameField.LEFT,4000000));
			gameBoard.add(end);
			
		}
		
		public static GameBoard getInstance(){
			if (GameBoard.INSTANCE==null){
				new GameBoard();
			}
			return INSTANCE;
		}
		
		public ArrayList<GameField> getGameBoard() throws Exception{
			if (gameBoard != null){
				return this.gameBoard;
			}else{
				throw new Exception ("GameBoard not initialized!");
			}
			
		}
		public GameField getStart() {
			return start;
		}
		public GameField getEnd() {
			return end;
		}
		public GameField getJail() {
			return jail;
		}
}
